// vite.config.ts
// -------------------- React 相关插件 --------------------
import { reactRouter } from "@react-router/dev/vite"
import tailwindcss from "@tailwindcss/vite"
import AutoImport from "unplugin-auto-import/vite"

// -------------------- Vite 核心与工具插件 --------------------
import { defineConfig } from "vite"
import tsconfigPaths from "vite-tsconfig-paths"

export default defineConfig({
  plugins: [
    tailwindcss(),
    reactRouter(),
    tsconfigPaths(),
    AutoImport({
      imports: [
        "react",
        {
          "framer-motion": ["motion"],
          react: [
            "useState",
            "useEffect",
            "useMemo",
            "useCallback",
            "useRef",
            "useContext",
            "useReducer",
            "useLayoutEffect",
            "useDebugValue",
            "useDeferredValue",
            "useTransition",
            "useId",
            "useSyncExternalStore",
            "useInsertionEffect",
          ],
        },
      ],
      dts: "./app/types/auto-imports.d.ts", // 自动导入类型声明输出目录
    }),
  ],
  define: {
    // 生产环境下启用 hydration mismatch 详细信息
    __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
  },
})
